package com.itheima.case2.service.impl;

import com.itheima.case2.dao.RoleMapper;
import com.itheima.case2.pojo.po.Role;
import com.itheima.case2.service.RoleService;
import com.itheima.case2.utils.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class RoleServiceImpl implements RoleService {
    @Override
    public List<Role> queryAllRole() {
        //1.获取会话对象
        SqlSession session = SqlSessionUtil.getSession();
        //2.获取代理接口
        RoleMapper mapper = session.getMapper(RoleMapper.class);
        //3.调用接口中的方法
       List<Role> roleList= mapper.queryRole();
       //4.将查询结果返回给web层
        return roleList;
    }
}
